package cn.edu.tju.cas.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Set;

/**
 * Created by catold on 16/3/12.
 */
@Entity
@Table(name = "USER_GROUP_APPLY", schema = "dev_cas", catalog = "")
public class UserGroupApplyEntity implements Serializable {
    private int userGroupApplyId;
//    private Integer userId;
//    private Integer groupId;
    private Integer status;
    private Timestamp createtime;
    private Timestamp updatetime;

    private UserEntity userEntity;
    private GroupEntity groupEntity;
    private Set<UserGroupFormValueEntity> userGroupFormValues;
    private String checkerName;

    public Set<UserGroupFormValueEntity> getUserGroupFormValues() {
        return userGroupFormValues;
    }

    public void setUserGroupFormValues(Set<UserGroupFormValueEntity> userGroupFormValues) {
        this.userGroupFormValues = userGroupFormValues;
    }

    public String getCheckerName() {
        return checkerName;
    }

    public void setCheckerName(String checkerName) {
        this.checkerName = checkerName;
    }

    public UserEntity getUserEntity() {
        return userEntity;
    }

    public void setUserEntity(UserEntity userEntity) {
        this.userEntity = userEntity;
    }

    public GroupEntity getGroupEntity() {
        return groupEntity;
    }

    public void setGroupEntity(GroupEntity groupEntity) {
        this.groupEntity = groupEntity;
    }

    @Id
    @GeneratedValue
    @Column(name = "USER_GROUP_APPLY_ID", nullable = false)
    public int getUserGroupApplyId() {
        return userGroupApplyId;
    }

    public void setUserGroupApplyId(int userGroupApplyId) {
        this.userGroupApplyId = userGroupApplyId;
    }

//    @Basic
//    @Column(name = "USER_ID", nullable = true)
//    public Integer getUserId() {
//        return userId;
//    }
//
//    public void setUserId(Integer userId) {
//        this.userId = userId;
//    }
//
//    @Basic
//    @Column(name = "GROUP_ID", nullable = true)
//    public Integer getGroupId() {
//        return groupId;
//    }
//
//    public void setGroupId(Integer groupId) {
//        this.groupId = groupId;
//    }

    @Basic
    @Column(name = "STATUS", nullable = true)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "CREATETIME", nullable = true)
    public Timestamp getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Timestamp createtime) {
        this.createtime = createtime;
    }

    @Basic
    @Column(name = "UPDATETIME", nullable = true)
    public Timestamp getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Timestamp updatetime) {
        this.updatetime = updatetime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserGroupApplyEntity that = (UserGroupApplyEntity) o;

        if (userGroupApplyId != that.userGroupApplyId) return false;
//        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
//        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (createtime != null ? !createtime.equals(that.createtime) : that.createtime != null) return false;
        if (updatetime != null ? !updatetime.equals(that.updatetime) : that.updatetime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userGroupApplyId;
//        result = 31 * result + (userId != null ? userId.hashCode() : 0);
//        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (createtime != null ? createtime.hashCode() : 0);
        result = 31 * result + (updatetime != null ? updatetime.hashCode() : 0);
        return result;
    }
}
